<?php
class runtime
{
	protected $_startTime;
	protected $_stopTime;
	protected $_spendTime;
	
	//获取返回当前微秒数的浮点数 
	public function getmicrotime()
	{ 
		list($usec,$sec)=explode(" ",microtime()); 
		//return bcadd($usec, (float)$sec, 6); 
		return (float)$usec + (float)$sec;
	} 
	
	//页面开始执行函数，返回开始页面执行的时间
	public function startTime() 
	{ 
		$this->_startTime = $this->getmicrotime(); 
	} 
	
	//显示页面执行的时间 
	public function showRunTime()
	{
		$this->_stopTime  = (float)$this->getmicrotime();
		echo '<br /><center>程序运行时间' . round($this->_stopTime - $this->_startTime, 4) . '</center><br />';	
	} 
	
}